package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.constant.RedisConstant;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.Address;
import com.itheima.service.AddressService;
import com.itheima.utils.QiniuUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import java.util.List;
import java.util.UUID;

@RestController
@RequestMapping("/address")
public class AddressController {

    @Reference
    private AddressService addressService;

    @RequestMapping("/findAllAddress.do")
    public Result findAllAddress(){
        try {
            List<Address> list = addressService.findAllAddress();
            return new Result(true,"",list);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,"获取地址失败");
        }
    }
    @RequestMapping("/findLatLngById.do")
    public Result findLatLngById(Integer id){
        try {
            String LatLng = addressService.findLatLngById(id);
            return new Result(true,"",LatLng);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,"获取经纬度失败");
        }
    }
}
